package com.ruoyi.system.api.factory;

import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteSysConfigService;
import com.ruoyi.system.api.domain.SysConfig;

/**
 * 参数配置微服务降级处理
 * 
 * @author ruoyi
 * @date 2023-04-26
 */
@Component
public class RemoteSysConfigFallbackFactory implements FallbackFactory<RemoteSysConfigService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSysConfigFallbackFactory.class);

    @Override
    public RemoteSysConfigService create(Throwable throwable)
    {
        log.error("参数配置服务调用失败:" + throwable.getMessage(), throwable);
        return new RemoteSysConfigService()
        {
            @Override
            public R<SysConfig> selectSysConfigByConfigId(Long configId, String source) {
                return null;
            }

            @Override
            public R<List<SysConfig>> selectSysConfigList(SysConfig sysConfig, String source) {
                return null;
            }

            @Override
            public R<Integer> insertSysConfig(SysConfig sysConfig, String source) {
                return null;
            }

            @Override
            public R<Integer> updateSysConfig(SysConfig sysConfig, String source) {
                return null;
            }

            @Override
            public R<Integer> deleteSysConfigByConfigIds(Integer[] configIds, String source) {
                return null;
            }

            @Override
            public R<Integer> resetConfigCache(String source) {
                return null;
            }

            @Override
            public R<String> selectConfigByKey(String configKey, String source) {
                return null;
            }
        };

    }
}
